// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import ElementUI from "element-ui";
import 'element-ui/lib/theme-chalk/index.css';
import VueRouter from "vue-router";
import router from './router/router'
//导入全局样式表
import './assets/css/global.css'
import axios from 'axios'

//导入NProgress 包对应的js和css
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

//设置根路径
axios.defaults.baseURL = 'http://localhost:8090/602system';

//（request拦截器）在发送请求时，事先在请求头中设置token,并且在这个地方展示进度条,NProgress.start()
axios.interceptors.request.use(config => {
  NProgress.start();
  config.headers.Authorization = window.sessionStorage.getItem("token")
  //必须return config
  return config;
});

//在Response拦截器中，隐藏进度条 NProgress.done()
axios.interceptors.response.use(config => {
  NProgress.done();
  return config;
});

Vue.prototype.$http = axios;



Vue.use(ElementUI);
Vue.use(VueRouter);
Vue.config.productionTip = false;

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render: h => h(App)

});
